$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

(function ($) {
    'use strict';
    
    $(document).ready(function () {
        NProgress.start();
    });

    $(window).load(function () {
        NProgress.done();
    })

    $(function () {
        var $fullText = $('.admin-fullText');
        $('#admin-fullscreen').on('click', function () {
            $.AMUI.fullscreen.toggle();
        });

        $(document).on($.AMUI.fullscreen.raw.fullscreenchange, function () {
            $fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏');
        });
    });

    //切换栏目
    $("#change_system").change(function () {
        var url = $(this).val();
        location.href = url;
    })

    //全选
    $("#checked").click(function () {
        $('.checked_id').prop("checked", this.checked);
    });

    /*//关闭浏览器提示信息
    window.onbeforeunload = function (e) {
        e = e || window.event;
        var y = e.clientY;
        if (y <= 0 || y >= Math.max(document.body ? document.body.clientHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0)//点击任务栏的关闭按钮

        ) {
            //IE 和 Firefox
            e.returnValue = "确定要刷新或关闭浏览器窗口？";
        }
        //谷歌
        $.ajax({
            type: "get",
            url: "/logout",
            success: function () {
                //location.href =location.href
            }
        });
    }
    */
    /*window.onbeforeunload = function(){
        Deletecookie ("laravel_session");
    };

    function Deletecookie (name) {  //删除名称为name的Cookie
        var exp = new Date();
        exp.setTime (exp.getTime() - 1);
        var cval = GetCookie (name);
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();  //设置cookie过期
    }*/

})(jQuery);